pull-local: Fix regression with absolute paths
authorColin Walters <walters@verbum.org>
Fri, 13 Feb 2015 16:39:02 +0000 (11:39 -0500)
committerColin Walters <walters@verbum.org>
Fri, 13 Feb 2015 16:39:36 +0000 (11:39 -0500)
Don't add cwd unless the path is relative.

src/ostree/ot-builtin-pull-local.c

index acad43bc96ef9efe341e935230e0bb3c5c498ae6..4588ccb05b9b6be9a2f70c43416e4d0070b744d8 100644 (file)
@@ -70,9 +70,13 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
 
   src_repo_arg = argv[1];
 
-  { gs_free char *cwd = g_get_current_dir ();
-    src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL);
-  }
+  if (src_repo_arg[0] == '/')
+    src_repo_uri = g_strconcat ("file://", src_repo_arg, NULL);
+  else
+    { 
+      gs_free char *cwd = g_get_current_dir ();
+      src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL);
+    }
 
   if (opt_disable_fsync)
     ostree_repo_set_disable_fsync (repo, TRUE);